//
//  CalculateAreaVisitor.swift
//  ArchitectGenerics
//
//  Created by 姚胜龙 on 2017/6/27.
//  Copyright © 2017年 姚胜龙. All rights reserved.
//

import UIKit

class CalculateAreaVisitor: ShapeVisitorProtocol {

    var totalArea:Float = 0

    func visite(circle: CircleShape1) {
        self.totalArea = self.totalArea + powf(circle.redius, 2) * 3.14
    }

    func visite(square: SquareShape1) {
        self.totalArea = self.totalArea + powf(square.length, 2)
    }

    func visite(rectangle: RectangleShape1) {
        self.totalArea = self.totalArea + rectangle.height * rectangle.width
    }

}
